Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@vncsna
vncsna / bash_strict_mode.md
Created June 6, 2021 01:59 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation

set -e, -u, -o, -x pipefail

The set lines

  • These lines deliberately cause your script to fail. Wait, what? Believe me, this is a good thing.
  • With these settings, certain common errors will cause the script to immediately fail, explicitly and loudly. Otherwise, you can get hidden bugs that are discovered only when they blow up in production.
  • set -euxo pipefail is short for:
set -e
set -u
@AlexV525
AlexV525 / init.gradle.kts
Last active June 2, 2024 09:01
Mirroring Gradle repositories
// Thanks to: https://gist.github.com/bennyhuo/af7c43cc4831661193605e124f539942
val urlMappings = mapOf(
"https://dl.google.com/dl/android/maven2" to "https://mirrors.tencent.com/nexus/repository/maven-public/",
"https://repo.maven.apache.org/maven2" to "https://mirrors.tencent.com/nexus/repository/maven-public/",
"https://plugins.gradle.org/m2" to "https://mirrors.tencent.com/nexus/repository/gradle-plugins/"
)
fun RepositoryHandler.mirroring() {
all {
@viruseg
viruseg / .Manually Convert World to Screen Position in Unity with Burst.cs
Last active June 2, 2024 09:00
Manually Convert World to Screen Position in Unity with Burst. The code is intended for the Burst compiler, which does the same thing as Camera.WorldToScreenPoint.
//camera-like projection matrix
var cameraData = new CameraDataForBurst(camera);
//or
//projection matrix for the rendering target of a given size
var cameraData = new CameraDataForBurst(camera, 320, 240);
var worldPoint = new float3(10, 10, 0);
var screenPointWithZ = cameraData.WorldToScreenPointWithZ(worldPoint);
var screenPoint = cameraData.WorldToScreenPoint(worldPoint);
@bennyhuo
bennyhuo / init.gradle.kts
Last active June 2, 2024 09:00
How to config mirrors for repositories in Gradle without changing the source code of your project?
fun RepositoryHandler.enableMirror() {
all {
if (this is MavenArtifactRepository) {
val originalUrl = this.url.toString().removeSuffix("/")
urlMappings[originalUrl]?.let {
logger.lifecycle("Repository[$url] is mirrored to $it")
this.setUrl(it)
}
}
}
@stravant
stravant / reloader.gd
Last active June 2, 2024 08:55
Simple plugin auto-reloader for Godot plugin development
################################################################################
## stravant's Godot plugin auto-reloader ##
## For ease of plugin development ##
## MIT licensed ##
## ##
## Call preload("./reloader.gd").new() in your EditorPlugin component's ##
## _enter_tree method to enable automatic reloading whenever you save changes ##
## to any of the plugin files for a tighter plugin rapid prototyping loop. ##
## ##
## Source: https://gist.github.com/stravant/7aec484bb5e34e3a6196faaa13159ac3 ##
@sebmarkbage
sebmarkbage / Infrastructure.js
Last active June 2, 2024 08:51
SynchronousAsync.js
let cache = new Map();
let pending = new Map();
function fetchTextSync(url) {
if (cache.has(url)) {
return cache.get(url);
}
if (pending.has(url)) {
throw pending.get(url);
}
@luckylittle
luckylittle / Splunk_Certified_Cybersecurity_Defense_Analyst.md
Last active June 2, 2024 08:49
Splunk Certified Cybersecurity Defense Analyst [SPLK-5001] - Notes

Splunk Certified Cybersecurity Defense Analyst [SPLK-5001]

1.0 The Cyber Landscape, Frameworks, and Standards (*10%*)
  1.1 Summarize the organization of a typical SOC and the tasks belonging to Analyst, Engineer and Architect roles.
  1.2 Recognize common cyber industry controls, standards and frameworks and how Splunk incorporates those frameworks.
  1.3 Describe key security concepts surrounding information assurance including confidentiality, integrity and availability and basic risk management.

2.0 Threat and Attack Types, Motivations, and Tactics (*20%*)
  2.1 Recognize common types of attacks and attack vectors.
@liamwh
liamwh / +page.svelte
Last active June 2, 2024 08:49
SvelteKit Otel
<script lang="ts">
import type { UserView } from '$lib/stubs/auth';
import { getContext, onMount } from 'svelte';
import { goto } from '$app/navigation';
import { getContacts } from '$lib/repositories/contacts';
import { browser } from '$app/environment';
import { CONTACTS_STORE_KEY, USER_STORE_KEY } from '$lib/store-keys';
import type { Writable } from 'svelte/store';
import AddContactButton from '$lib/components/Contacts/AddContact/AddContactButton.svelte';
import { db } from '$lib/surrealdb';
@adrianhajdin
adrianhajdin / CommunityCard.tsx
Last active June 2, 2024 08:48
Build and Deploy a Full Stack MERN Next.js 13 Threads App | React, Next JS, TypeScript, MongoDB
import Image from "next/image";
import Link from "next/link";
import { Button } from "../ui/button";
interface Props {
id: string;
name: string;
username: string;
imgUrl: string;